package com.york.learning.springbootlistenerdemo;

import com.york.learning.springbootlistenerdemo.listener.MyApplicationEnvironmentPreparedEventListener;
import com.york.learning.springbootlistenerdemo.listener.MyApplicationFailedEventListener;
import com.york.learning.springbootlistenerdemo.listener.MyApplicationPreparedEventListener;
import com.york.learning.springbootlistenerdemo.listener.MyApplicationReadyEventListener;
import com.york.learning.springbootlistenerdemo.listener.MyApplicationStartedEventListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringBootListenerDemoApplication {

	public static void main(String[] args) {
		// 初始化application
		SpringApplication application = new SpringApplication(SpringBootListenerDemoApplication.class);
		// 添加监听器
		application.addListeners(new MyApplicationStartedEventListener());
		application.addListeners(new MyApplicationEnvironmentPreparedEventListener());
		application.addListeners(new MyApplicationPreparedEventListener());
		application.addListeners(new MyApplicationFailedEventListener());
		application.addListeners(new MyApplicationReadyEventListener());
		// 执行application
		application.run(args);
	}
}
